from django import forms
from django.forms.util import ErrorList

from django.contrib.auth import authenticate, login

class ErrorList(ErrorList):
    """
    Show errors in DIV HTML tags.
    """
    
    def __unicode__(self):
        return self.as_divs()
    
    def as_divs(self):
        if not self:
            return u''
        
        return u'<div class="errorlist">%s</div>' % ''.join([u'<div class="error">%s</div>' % e for e in self])

class LogInForm(forms.Form,):
    """
    User log in form.
    """
    
    username = forms.CharField()
    password = forms.CharField(widget=forms.PasswordInput())
